<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('labor_contracts', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('project_id');
            $table->unsignedBigInteger('labor_id');
            $table->unsignedBigInteger('team_id');
            $table->unsignedBigInteger('user_id');
            $table->string('type')->nullable('')->comment('类型');
            $table->decimal('price', 10, 2)->default(0);
            $table->integer('tax_rate')->default(0);
            $table->decimal('tax_price', 10, 2)->default(0)->comment('税金');
            $table->string('name', 255)->default('/')->comment('甲方名称');
            $table->string('tax_id', 50)->nullable()->default('/')->comment('甲方税号');
            $table->string('address', 255)->nullable()->default('/')->comment('甲方地址');
            $table->string('mobile', 20)->nullable()->default('/')->comment('甲方联系电话');
            $table->string('bank', 255)->nullable()->default('/')->comment('甲方开户银行');
            $table->string('bank_number', 255)->nullable()->default('/')->comment('甲方开户好');
            $table->string('bank_account', 50)->nullable()->default('/')->comment('甲方银行账号');
            $table->string('email', 255)->nullable()->default('/')->comment('');
            $table->string('postal_code', 50)->nullable()->default('/')->comment('邮编');

            $table->string('b_name', 255)->default('/')->comment('乙方名称');
            $table->string('b_tax_id', 50)->nullable()->default('/')->comment('乙方税号');
            $table->string('b_address', 255)->nullable()->default('/')->comment('乙方地址');
            $table->string('b_mobile', 20)->nullable()->default('/')->comment('乙方联系电话');
            $table->string('b_bank', 255)->nullable()->default('/')->comment('乙方开户银行');
            $table->string('b_bank_number', 255)->nullable()->default('/')->comment('乙方开户好');
            $table->string('b_bank_account', 50)->nullable()->default('/')->comment('乙方银行账号');
            $table->string('b_email', 255)->nullable()->default('/')->comment('');
            $table->string('b_postal_code', 50)->nullable()->default('/')->comment('邮编');
            $table->string('entrusted_agent')->nullable()->default('/')->comment('上传委托代理授权书');
            $table->string('agent')->nullable()->default('/')->comment('上传代理人');

            $table->string('u_name')->nullable()->default('/')->comment('姓名');
            $table->string('u_idard')->nullable()->default('/')->comment('身份证号码');
            $table->string('u_address')->nullable()->default('/')->comment('家庭地址');
            $table->string('u_mobile')->nullable()->default('/')->comment('手机号码');
            $table->string('u_contacts')->nullable()->default('/')->comment('家庭联系人');
            $table->string('u_contacts_mobile')->nullable()->default('/')->comment('家庭联系人电话');
            $table->string('u_idard_file')->nullable()->default('/')->comment('上传身份证');
            $table->string('u_work')->nullable()->default('/')->comment('工种');
            $table->string('u_email')->nullable()->default('/')->comment('email');

            $table->string('build_address')->nullable()->default('/')->comment('施工地点');
            $table->string('craft')->nullable()->default('/')->comment('工艺要求');
            $table->string('receiver')->nullable()->default('/')->comment('验收人');
            $table->string('sums')->nullable()->default('/')->comment('工作数量');
            $table->string('unit_price')->nullable()->default('/')->comment('工作单价');
            $table->string('pay_type')->nullable()->default('/')->comment('付款方式');
            $table->string('apply_id')->nullable()->default('/')->comment('申请人');
            $table->string('liquidated_damages')->nullable()->default('/')->comment('违约金');
            $table->string('approver')->nullable()->default('/')->comment('审批人');
            $table->string('remarks')->nullable()->default('/')->comment('备注');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('labor_contracts');
    }
};
